package com.example.langchaindemo1.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

/**
 * 
 * @TableName memory
 */
@TableName(value ="memory")
@Data
public class Memory {
    /**
     * 序号
     */
    @TableId(value = "id")
    private Integer id;

    /**
     * 用户的提问
     */
    @TableField(value = "userMessage")
    private String userMessage;

    /**
     * 大模型的返回结果
     */
    @TableField(value = "response")
    private String response;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Memory other = (Memory) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUserMessage() == null ? other.getUserMessage() == null : this.getUserMessage().equals(other.getUserMessage()))
            && (this.getResponse() == null ? other.getResponse() == null : this.getResponse().equals(other.getResponse()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUserMessage() == null) ? 0 : getUserMessage().hashCode());
        result = prime * result + ((getResponse() == null) ? 0 : getResponse().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", userMessage=").append(userMessage);
        sb.append(", response=").append(response);
        sb.append("]");
        return sb.toString();
    }
}